﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Hollysys.Mes.Common.Utilities
{
    public class Functions
    {
        /// <summary>
        /// 计算总页数
        /// </summary>
        /// <param name="numberOfRecords">记录总数</param>
        /// <param name="pageSize">每页记录数</param>
        /// <returns>总页数</returns>
        public static long CalculateTotalPages(long numberOfRecords, Int32 pageSize)
        {
            long result;
            long totalPages;

            Math.DivRem(numberOfRecords, pageSize, out result);

            if (result > 0)
                totalPages = (long)((numberOfRecords / pageSize)) + 1;
            else
                totalPages = numberOfRecords / pageSize;

            return totalPages;

        }
    }
}
